package com.lightboat.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lightboat.common.utils.DateUtils;
import com.lightboat.system.domain.CrmPerformancePlan;
import com.lightboat.system.mapper.CrmPerformancePlanMapper;
import com.lightboat.system.service.ICrmPerformancePlanService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 业绩计划Service业务层处理
 *
 * @author lightboat
 * @date 2025-11-10
 */
@Service
@RequiredArgsConstructor
public class CrmPerformancePlanServiceImpl extends ServiceImpl<CrmPerformancePlanMapper, CrmPerformancePlan> implements ICrmPerformancePlanService {

    private final CrmPerformancePlanMapper crmPerformancePlanMapper;

    /**
     * 查询业绩计划
     *
     * @param id 业绩计划主键
     * @return 业绩计划
     */
    @Override
    public CrmPerformancePlan selectCrmPerformancePlanById(Long id) {
        return crmPerformancePlanMapper.selectById(id);
    }

    /**
     * 查询业绩计划列表
     *
     * @param crmPerformancePlan 业绩计划
     * @return 业绩计划
     */
    @Override
    public List<CrmPerformancePlan> selectCrmPerformancePlanList(CrmPerformancePlan crmPerformancePlan) {
        return crmPerformancePlanMapper.selectCrmPerformancePlanList(crmPerformancePlan);
    }

    /**
     * 新增业绩计划
     *
     * @param crmPerformancePlan 业绩计划
     * @return 结果
     */
    @Override
    public int insertCrmPerformancePlan(CrmPerformancePlan crmPerformancePlan) {
        crmPerformancePlan.setCreateTime(DateUtils.getNowDate());
        return crmPerformancePlanMapper.insert(crmPerformancePlan);
    }

    /**
     * 修改业绩计划
     *
     * @param crmPerformancePlan 业绩计划
     * @return 结果
     */
    @Override
    public int updateCrmPerformancePlan(CrmPerformancePlan crmPerformancePlan) {
        crmPerformancePlan.setUpdateTime(DateUtils.getNowDate());
        return crmPerformancePlanMapper.updateById(crmPerformancePlan);
    }

    /**
     * 批量删除业绩计划
     *
     * @param ids 需要删除的业绩计划主键
     * @return 结果
     */
    @Override
    public int deleteCrmPerformancePlanByIds(Long[] ids) {
        return crmPerformancePlanMapper.deleteCrmPerformancePlanByIds(ids);
    }

    /**
     * 删除业绩计划信息
     *
     * @param id 业绩计划主键
     * @return 结果
     */
    @Override
    public int deleteCrmPerformancePlanById(Long id) {
        return crmPerformancePlanMapper.deleteCrmPerformancePlanById(id);
    }
}
